package com.nbsaas.boot.project.rest.resource;

import com.nbsaas.boot.jpa.data.core.BaseResource;
import com.nbsaas.boot.project.api.apis.ProjectDiaryApi;
import com.nbsaas.boot.project.api.domain.request.ProjectDiaryRequest;
import com.nbsaas.boot.project.api.domain.response.ProjectDiaryResponse;
import com.nbsaas.boot.project.api.domain.simple.ProjectDiarySimple;
import com.nbsaas.boot.project.data.entity.ProjectDiary;
import com.nbsaas.boot.project.data.repository.ProjectDiaryRepository;
import com.nbsaas.boot.project.rest.convert.ProjectDiaryEntityConvert;
import com.nbsaas.boot.project.rest.convert.ProjectDiaryResponseConvert;
import com.nbsaas.boot.project.rest.convert.ProjectDiarySimpleConvert;
import jakarta.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.io.Serializable;
import java.util.function.Function;
/**
 *   项目日志-业务接口实现
 */
@Transactional
@Service
public class ProjectDiaryResource extends BaseResource<ProjectDiary, ProjectDiaryResponse, ProjectDiarySimple, ProjectDiaryRequest> implements ProjectDiaryApi {

    @Resource
    private ProjectDiaryRepository projectDiaryRepository;

    @Override
    public JpaRepositoryImplementation<ProjectDiary, Serializable> getJpaRepository() {
        return projectDiaryRepository;
    }

    @Override
    public Function<ProjectDiary, ProjectDiarySimple> getConvertSimple() {
        return new ProjectDiarySimpleConvert();
    }

    @Override
    public Function<ProjectDiaryRequest, ProjectDiary> getConvertForm() {
        return new ProjectDiaryEntityConvert();
    }

    @Override
    public Function<ProjectDiary, ProjectDiaryResponse> getConvertResponse() {
        return new ProjectDiaryResponseConvert();
    }


}


